<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>ThinkPHP5.0</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__STATIC__/style/bootstrap.css" rel="stylesheet">
    <link href="__STATIC__/style/font-awesome.css" rel="stylesheet">
    <link href="__STATIC__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__STATIC__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__STATIC__/style/demo.css" rel="stylesheet">
    <link href="__STATIC__/style/typicons.css" rel="stylesheet">
    <link href="__STATIC__/style/animate.css" rel="stylesheet">
    <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
    <script src="__STATIC__/plus/layer/layer.js"></script>
<style>
.open{
    border: 1px solid #ccc;
padding: 0 3px 0 3px;
cursor: pointer;
}
</style>
</head>

<body>
    <!-- 头部 -->
    {include file="common/head"}

    <!-- /头部 -->

    <div class="main-container container-fluid">
        <div class="page-container">
            <!-- Page Sidebar -->
            <div class="page-sidebar" id="sidebar">
                <!-- Page Sidebar Header-->
                <div class="sidebar-header-wrapper">
                    <input class="searchinput" type="text">
                    <i class="searchicon fa fa-search"></i>
                    <div class="searchhelper">Search Reports, Charts, Emails or Notifications</div>
                </div>
                <!-- /Page Sidebar Header -->
                <!-- Sidebar Menu -->
                {include file="common/left"}
                <!-- /Sidebar Menu -->
            </div>
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                        <li class="active">

                            <i class="fa fa-home"></i>
                            <a href="{:url('collection/index')}">
                                采集管理
                            </a>
                        </li>
                    </ul>

                </div>
                <!-- /Page Breadcrumb -->

<!-- Page Body -->
<div class="page-body">

<button type="button" tooltip="添加" class="btn btn-sm btn-azure btn-addon"
onclick="javascript:window.location.href = '{:url('admin/collection/create')}'"> <i
class="fa fa-plus"></i> Add
</button>
<div class="row">
<div class="col-lg-12 col-sm-12 col-xs-12">
<div class="widget">
    <div class="widget-body">
        <div class="flip-scroll">
            <table class="table table-bordered table-hover">
                <thead class="">
                    <tr>
                        <th class="text-center" width="40%">节点名称</th>
                        <th class="text-center">导出数据</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td align="center">{$modelname}</td>
                        <td align="center">
                            <select name="cate_id">
                                <option value="0">选择栏目</option>
                                {volist name="cateRes" id="vo"}
                                  <option {if condition="$vo['model_id'] neq $modelid"} disabled="disabled" {/if} value="{$vo.id}">{$vo.catename}</option>
                                {/volist}
                            </select>
                            <a href="javascript:;" id="export" onclick="exportdata()" class="btn btn-default">导出数据</a>
                        </td>
                    </tr>
                    <tr>
                    <td colspan="2">
                        <div id="loading-1" style="text-align:center; padding:20px 0; display:none;">
                        <img src="/static/admin/images/loading-1.gif"> <span>采集中......</span>
                        </div>
                        <div id="dg" style="text-align:center; padding:20px 0; display:none;">
                        <img src="/static/admin/images/dg.png"> <span>采集完成！</span>
                        </div>
                        <div id="export_data" style="text-align:center; padding:20px 0; display:none;">
                        <img src="/static/admin/images/loading-1.gif"> <span>导出数据中......</span>
                        </div>
                        <div id="export_done" style="text-align:center; padding:20px 0; display:none;">
                        <img src="/static/admin/images/dg.png"> <span>导出完成！</span>
                        </div>
                        <div style="text-align:center;">
                        <a id="cjbtn" href="javascript:;" onclick="caiji()" class="btn btn-primary btn-sm shiny">
                                <i class="menu-icon fa fa-bug"></i> 开始采集
                        </a>
                        </div>
                    </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div>
                            </div>
    </div>
</div>
</div>
</div>
</div>
</div>

</div>

</div>
            <!-- /Page Body -->
        </div>
        <!-- /Page Content -->
    </div>
    </div>

    <!--Basic Scripts-->
    <script src="__STATIC__/style/jquery_002.js"></script>
    <script src="__STATIC__/style/bootstrap.js"></script>
    <script src="__STATIC__/style/jquery.js"></script>
    <!--Beyond Scripts-->
    <script src="__STATIC__/style/beyond.js"></script>
    <script type="text/javascript">
        function caiji(){
            var id={$id};//当前节点id
            $.ajax({
                type:"post",
                dataType:"json",
                data:{id:id},
                url:"{:url('collection/doCollect')}",
                success:function(data){
                    if(data==1){
                        $("#cjbtn").removeClass("disabled");
                        $("#loading-1").hide();
                        $("#dg").show();
                    }
                }
            });
            $("#dg").hide();
            $("#loading-1").show();
            $("#cjbtn").addClass("disabled");
        }

        function exportdata(){
            var cate_id=$("select[name=cate_id]").find("option:selected").val();
            if(cate_id==0){
                alert('请选择栏目！');
                return false;
            }
            var id={$id};//当前节点id
            $.ajax({
                type:"post",
                dataType:"json",
                data:{id:id,cate_id:cate_id},
                url:"{:url('collection/exportdata')}",
                success:function(data){
                    if(data==1){
                      $("#export").removeClass("disabled");
                      $("#export_data").hide();
                      $("#export_done").show();
                    }
                }
            });
            $("#dg").hide();
            $("#export_done").hide();
            $("#export_data").show();
            $("#export").addClass("disabled");
            $("#cjbtn").addClass("disabled");
        }

        
    </script>


</body>

</html>